* Use data from
* Replication Data for: Does Party Trump Ideology? Disentangling Party and Ideology in America
* https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/38BFML

use "Ideology_Trump.dta" 

codebook knowledge

reg Support i.race_white i.libtrump##c.knowledge i.contrump##c.knowledge if contrump==1 | self==1 | libtrump==1

margins r.libtrump, at(knowledge=0)
margins r.libtrump, at(knowledge=1)
margins r.libtrump, at(knowledge=2)
margins r.libtrump, at(knowledge=3)
margins r.libtrump, at(knowledge=4)
margins r.libtrump, at(knowledge=5)
margins r.libtrump, at(knowledge=6)
margins r.libtrump, at(knowledge=7)
margins r.libtrump, at(knowledge=8)

margins r.contrump, at(knowledge=0)
margins r.contrump, at(knowledge=1)
margins r.contrump, at(knowledge=2)
margins r.contrump, at(knowledge=3)
margins r.contrump, at(knowledge=4)
margins r.contrump, at(knowledge=5)
margins r.contrump, at(knowledge=6)
margins r.contrump, at(knowledge=7)
margins r.contrump, at(knowledge=8)

reg Support i.race_white i.libtrump##i.knowledge i.contrump##i.knowledge if contrump==1 | self==1 | libtrump==1

margins r.libtrump, at(knowledge=0)
margins r.libtrump, at(knowledge=1)
margins r.libtrump, at(knowledge=2)
margins r.libtrump, at(knowledge=3)
margins r.libtrump, at(knowledge=4)
margins r.libtrump, at(knowledge=5)
margins r.libtrump, at(knowledge=6)
margins r.libtrump, at(knowledge=7)
margins r.libtrump, at(knowledge=8)

margins r.contrump, at(knowledge=0)
margins r.contrump, at(knowledge=1)
margins r.contrump, at(knowledge=2)
margins r.contrump, at(knowledge=3)
margins r.contrump, at(knowledge=4)
margins r.contrump, at(knowledge=5)
margins r.contrump, at(knowledge=6)
margins r.contrump, at(knowledge=7)
margins r.contrump, at(knowledge=8)

**************************************
* Check to make sure the above method works
* Run with no control for race_white

// libtrump, for knowledge==0
// .0352941 each time

reg Support i.libtrump##i.knowledge i.contrump##i.knowledge if contrump==1 | self==1 | libtrump==1
margins, at(libtrump==1 knowledge==0)
margins, at(libtrump==0 knowledge==0)
di .7930664 - .7577723
margins r.libtrump, at(knowledge=0)

reg Support i.libtrump##i.knowledge if contrump==0 & (self==1 | libtrump==1)
margins, at(libtrump==1 knowledge==0)
margins, at(libtrump==0 knowledge==0)
di .8 - .7647059
margins r.libtrump, at(knowledge=0)

sum Support if libtrump==1 & contrump==0 & self==0 & knowledge==0
sum Support if libtrump==0 & contrump==0 & self==1 & knowledge==0
di .8 - .7647059

// contrump, for knowledge==7
// .200877 each time

reg Support i.libtrump##i.knowledge i.contrump##i.knowledge if contrump==1 | self==1 | libtrump==1
margins, at(contrump==1 knowledge==7)
margins, at(contrump==0 knowledge==7)
di .7863505 - .5854735
margins r.contrump, at(knowledge=7)

reg Support i.contrump##i.knowledge if libtrump==0 & (self==1 | contrump==1)
margins, at(contrump==1 knowledge==7)
margins, at(contrump==0 knowledge==7)
di .7661692 - .5652921
margins r.contrump, at(knowledge=7)

sum Support if contrump==1 & libtrump==0 & self==0 & knowledge==7
sum Support if contrump==0 & libtrump==0 & self==1 & knowledge==7
di .7661692 - .5652921
